package pl.edu.agh.gronoMining.frequentSubgraphFinder.frequentSearcher.subgraph.impl;

import java.util.Comparator;

import pl.edu.agh.gronoMining.frequentSubgraphFinder.graph.Node;

/**
 * Compare Nodes using DFS lexygraphic order
 * @param <T>
 */
public class NodesDFSComparator<T extends Node> implements Comparator<T> {

	@Override
	public int compare(T o1, T o2) {
		Node node1 = (Node) o1;
		Node node2 = (Node) o2;
		if (node1.getType() < node2.getType())
			return 1;
		if (node1.getType() > node2.getType())
			return -1;
		if (node1.getLabel() < node2.getLabel())
			return 1;
		if (node1.getLabel() > node2.getLabel())
			return -1;
		return 0;
	}

}
